<!--
 * @Author: YNT 2501512800@qq.com
 * @Date: 2022-06-19 15:06:46
 * @LastEditors: YNT 2501512800@qq.com
 * @LastEditTime: 2022-07-07 14:28:10
 * @FilePath: \智慧社区的副本\src\components\RealName.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div>{{name}}</div>
</template>

<script>
import API from '@/api';
export default {
  props: {
    nameId: Number,
    req: {
      type: String,
      default: 'getHouseholdInfo'
    }
  },
  data: () => ({
    name: ''
  }),
  mounted() {
    if(this.req=="getVoteOptionInfo"){
      API[this.req](this.nameId)
      .then(({data}) => {
        let array=data.options.map((item)=>{
          return item.name
        })
        this.name = array.join()
      }).catch(() => {
      });
    }else{
      API[this.req](this.nameId)
      .then(({data}) => {
        this.name = data.name
      }).catch(() => {
      });
    }
  }
}
</script>

<style>

</style>
